﻿<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
	<meta charset="utf-8" />
    <script src="../scripts/jquery-1.10.2.js"></script>
    <script type="text/javascript">
        function publish() {
            var content = $('#txt_content').val();
            $('#d_paste').append('<div>' + content + '</div>');
            localStorage.setItem('k_con', $('#d_paste').html());
        }
        function cleart() {
            $('#txt_content').val('');
            $('#d_paste').html('');
            localStorage.clear();
        }
        $(function () {
            if (localStorage.getItem('k_con')!=null) {
                $('#d_paste').html(localStorage.getItem('k_con'));
            }
        });
    </script>
</head>
<body>
    <textarea id="txt_content" rows="6" cols="30"></textarea>
    <div>
        <input type="button" value="发表" id="btnPublish" onclick="publish()" />
        <input type="button" value="清空" id="btnClear" onclick="cleart()" />
    </div>
    
    <div id="d_paste"></div>
</body>
</html>
